package com.sds.shop.action;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sds.fw.mvc.Action;
import com.sds.fw.mvc.HttpUtil;
import com.sds.shop.dao.OrderDAO;
import com.sds.shop.dao.PaymentDAO;
import com.sds.shop.vo.OrderVO;
import com.sds.shop.vo.PaymentVO;

public class PaymentAction extends Action {

	@Override
	public void execute(HttpServletRequest request, HttpServletResponse response)
			throws IOException, ServletException {
		PaymentDAO pdao = PaymentDAO.getInstance();
		String ord_no = request.getParameter("ord_no");
		OrderDAO odao = OrderDAO.getInstance();
		OrderVO ovo = odao.getOrder(ord_no);
		pdao.doPay(ovo);
		ArrayList<PaymentVO> pay_list = pdao.getPayList("");
		request.setAttribute("pay_list", pay_list);
		
		HttpUtil.forward(request, response, "/jsp/orderview.jsp");
	}

}
